package com.b2c.product.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import content.common.DateFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 参数表
 * @TableName mall_spec_param
 */
@TableName(value ="mall_spec_param")
@Data
public class SpecParam implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 品类编号
     */
    @TableField(value = "spg_id")
    private Integer spgId;

    /**
     * 参数编号
     */
    @TableField(value = "spp_id")
    private Integer sppId;

    /**
     * 参数名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 是否为数字参数
     */
    @TableField(value = "numeric")
    private Integer numeric;

    /**
     * 单位（量词语）
     */
    @TableField(value = "unit")
    private String unit;

    /**
     * 参数值限定值，参数必须是参数值中的几个。可以指定多个，使用逗号分隔。
     */
    @TableField(value = "segements")
    private String segements;

    /**
     * 
     */
    @TableField(value = "deleted")
    @TableLogic
    private Integer deleted;

    /**
     * 
     */
    @TableField(value = "createTime")
    @DateTimeFormat(pattern = DateFormat.FORMAT_PATTERN_SECODE)
    @JsonFormat(pattern = DateFormat.FORMAT_PATTERN_SECODE)
    private LocalDateTime createtime;

    /**
     * 
     */
    @TableField(value = "updateTime")
    @DateTimeFormat(pattern = DateFormat.FORMAT_PATTERN_SECODE)
    @JsonFormat(pattern = DateFormat.FORMAT_PATTERN_SECODE)
    private LocalDateTime updatetime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SpecParam other = (SpecParam) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSpgId() == null ? other.getSpgId() == null : this.getSpgId().equals(other.getSpgId()))
            && (this.getSppId() == null ? other.getSppId() == null : this.getSppId().equals(other.getSppId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getNumeric() == null ? other.getNumeric() == null : this.getNumeric().equals(other.getNumeric()))
            && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
            && (this.getSegements() == null ? other.getSegements() == null : this.getSegements().equals(other.getSegements()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()))
            && (this.getUpdatetime() == null ? other.getUpdatetime() == null : this.getUpdatetime().equals(other.getUpdatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSpgId() == null) ? 0 : getSpgId().hashCode());
        result = prime * result + ((getSppId() == null) ? 0 : getSppId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getNumeric() == null) ? 0 : getNumeric().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getSegements() == null) ? 0 : getSegements().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        result = prime * result + ((getUpdatetime() == null) ? 0 : getUpdatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", spgId=").append(spgId);
        sb.append(", sppId=").append(sppId);
        sb.append(", name=").append(name);
        sb.append(", numeric=").append(numeric);
        sb.append(", unit=").append(unit);
        sb.append(", segements=").append(segements);
        sb.append(", deleted=").append(deleted);
        sb.append(", createtime=").append(createtime);
        sb.append(", updatetime=").append(updatetime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}